home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 10633 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.2 KB

  1. Path: rcp6.elan.af.mil!rscernix!danpop
  2. From: danpop@mail.cern.ch (Dan Pop)
  3. Newsgroups: comp.sources.wanted,comp.lang.c,comp.unix.programmer
  4. Subject: Re: Seek unix2dos.c OR help with tr
  5. Date: 15 Mar 96 02:37:09 GMT
  6. Organization: CERN European Lab for Particle Physics
  7. Message-ID: <danpop.826857429@rscernix>
  8. References: <4i0946$7io@nuke.csu.net> <danpop.826545577@rscernix> <4i9dj4INN7kl@keats.ugrad.cs.ubc.ca>
  9. NNTP-Posting-Host: ues5.cern.ch
  10. X-Newsreader: NN version 6.5.0 #7 (NOV)
  11.  
  12. In <4i9dj4INN7kl@keats.ugrad.cs.ubc.ca> c2a192@ugrad.cs.ubc.ca (Kazimir Kylheku) writes:
  13.  
  14. >When I know that I'm specifically dealing with ASCII control chars, I have a
  15. >macro like:
  16. >
  17. >#define CTRL(C) ((C)-64)
  18.  
  19. I'd define it like this:
  20.  
  21. #define CTRL(C) ((C) & 0x1F)
  22.  
  23. >which I then use with capital letters:
  24.  
  25. which can be used with both lower and upper case letters.
  26.  
  27. My preference for the '&' operator is probably related to the fact that 
  28. I had to repair broken keyboards (amongst many other pieces of hardware)
  29. in a previous life, and this is how the CTRL key logic was implemented on
  30. those keyboards :-)
  31.  
  32. Dan
  33. --
  34. Dan Pop
  35. CERN, CN Division
  36. Email: danpop@mail.cern.ch 
  37. Mail:  CERN - PPE, Bat. 31 R-004, CH-1211 Geneve 23, Switzerland
  38.